package top.oylan.manager.tools;

import java.util.List;

/**
 * Created by Administrator on 2018/12/23.
 */
public class Pager<T> {


    private T condition;
    /** 总数 **/
    private int totalRow = 0;

    /** 每页数 **/
    private int eveyPageRow = 12;

    /** 总页数 **/
    private int totalPage = 1;

    /** 当前页 **/
    private int currentPage = 1;

    /** 分页获得实体 **/
    List<T> list;

    public T getCondition() {
        return condition;
    }

    public void setCondition(T condition) {
        this.condition = condition;
    }

    public int getTotalRow() {
        return totalRow;
    }

    public void setTotalRow(int totalRow) {
        int totalPage = totalRow /eveyPageRow;
        if(totalPage * eveyPageRow < totalRow){
           totalPage++;
        }
        this.totalRow = totalRow;
        setTotalPage(totalPage);
    }

    public int getEveyPageRow() {
        return eveyPageRow;
    }

    public void setEveyPageRow(int eveyPageRow) {
        this.eveyPageRow = eveyPageRow;
    }

    public int getTotalPage() {
        return totalPage;
    }

    private void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
